﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using SUMO.MediaBrowser.Foundation;
using SUMO.MediaBrowser.ViewModel;

namespace SUMO.MediaBrowser.Controls
{
    public partial class UploadWindow : ChildWindow
    {
        public UploadWindow()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(UploadWindow_Loaded);
            this.DataContext = PendingModifications.Current;
        }

        void UploadWindow_Loaded(object sender, RoutedEventArgs e)
        {
            PendingList.ItemsSource = PendingModifications.Current.ModifiedItems;
        }

        private void CloseButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }

        public static UploadWindow Current
        {
            get { return Singleton<UploadWindow>.Instance; }
        }

        private void BeginUploadButton_Click(object sender, RoutedEventArgs e)
        {
            PendingModifications.Current.SaveAsync();
        }

    }
}

